package org.example.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.example.domain.GoodsAddress;
import org.example.domain.esdomain.UserIndex;

import java.util.Date;
import java.util.List;

/**
 * app用户详细信息实体
 */
@Data
public class AppUserPojo {

    /**
     * 用户头像
     */
    private String headImage;

    /**
     * 账号
     */
    private String account;

    /**
     * 名称
     */
    private String userName;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 电话号码
     */
    private String phone;

    /**
     * 电子邮箱
     */
    private String email;

    /**
     * 性别
     */
    private Integer sex;

    /**
     * 出生日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthday;

    /**
     * 家庭住址
     */
    private String address;

    /**
     * 详细地址
     */
    private String addressDetail;

    /**
     * 登录次数
     */
    private Integer loginNum;

    /**
     * 登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date loginTime;

    /**
     * 状态（0：未登录，1：已登录，2：已注销）
     */
    private Integer status;

    /**
     * 注册时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 收货地址
     */
    List<GoodsAddress> goodsAddressList;

    public AppUserPojo(UserIndex userIndex) {
        this.headImage = userIndex.getHeadImage();
        this.account = userIndex.getAccount();
        this.userName = userIndex.getUserName();
        this.nickName = userIndex.getNickName();
        this.phone = userIndex.getPhone();
        this.email = userIndex.getEmail();
        this.sex = userIndex.getSex();
        this.birthday = userIndex.getBirthday();
        this.address = userIndex.getAddress();
        this.addressDetail = userIndex.getAddressDetail();
        this.loginNum = userIndex.getLoginNum();
        this.loginTime = userIndex.getLoginTime();
        this.status = userIndex.getStatus();
        this.createTime = userIndex.getCreateTime();
        this.updateTime = userIndex.getUpdateTime();
    }
}
